package com.shuzixiangcun.service.front;

import com.shuzixiangcun.dao.JobApplicationsDao;
import com.shuzixiangcun.entity.JobApplications;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 求职表(JobApplications)表服务实现类
 *
 * @author makejava
 * @since 2024-06-24 08:26:20
 */
@Service
public class JobApplicationsFServiceImpl {
    @Resource
    private JobApplicationsDao jobApplicationsDao;

    /**
     * 通过ID查询单条数据
     *
     * @param applicationId 主键
     * @return 实例对象
     */

    public JobApplications queryById(Integer applicationId) {
        return this.jobApplicationsDao.queryById(applicationId);
    }

    /**
     * 分页查询
     *
     * @param jobApplications 筛选条件
     * @param pageRequest     分页对象
     * @return 查询结果
     */


    /**
     * 新增数据
     *
     * @param jobApplications 实例对象
     * @return 实例对象
     */

    public JobApplications insert(JobApplications jobApplications) {
        this.jobApplicationsDao.insert(jobApplications);
        return jobApplications;
    }

    /**
     * 修改数据
     *
     * @param jobApplications 实例对象
     * @return 实例对象
     */

    public JobApplications update(JobApplications jobApplications) {
        this.jobApplicationsDao.update(jobApplications);
        return this.queryById(jobApplications.getApplicationId());
    }

    /**
     * 通过主键删除数据
     *
     * @param applicationId 主键
     * @return 是否成功
     */

    public boolean deleteById(Integer applicationId) {
        return this.jobApplicationsDao.deleteById(applicationId) > 0;
    }


    public List<JobApplications> queryListApplications(Integer user_id,Integer id) {
        return this.jobApplicationsDao.getJobApplications(user_id,id);
    }
}
